package com.tuo51.core.domain.ppp.rel;

import com.tuo51.foudation.model.UnionKey;
import lombok.Data;

import javax.persistence.*;

@Entity
@Data
@Table(name = "rel_staff_position")
public class RelStaffPosition {
    @EmbeddedId
    @AttributeOverrides({@AttributeOverride(name = "domainId", column = @Column(name = "staffId", nullable = false, length = 32)),
            @AttributeOverride(name = "linkId", column = @Column(name = "positionId", nullable = false, length = 32))})
    private UnionKey id;


    public static RelStaffPosition of(String staffId, String positionId){
        RelStaffPosition rel = new RelStaffPosition();
        rel.setId(UnionKey.of(staffId, positionId));
        return rel;
    }
}
